Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactNative 问题汇总 #22

Open
hstarorg opened this issue Jan 16, 2019 · 1 comment
Open

ReactNative 问题汇总 #22

hstarorg opened this issue Jan 16, 2019 · 1 comment

Comments

@hstarorg
Copy link
Owner

hstarorg commented Jan 16, 2019

Collection the react native questions.

1. TouchableWithoutFeedback onPress 不生效?

原因分析: TouchableWithoutFeedback 需要 <View> 作为直接子集,如果children不是<View />,则不会生效,举例如下:

const Hello = props => <View><Text>Hello</Text></View>;
// Not working
<TouchableWithoutFeedback onPress={()=>alert('working')}>
  <Hello />
</TouchableWithoutFeedback>

// Working
<TouchableWithoutFeedback onPress={()=>alert('working')}>
  <View>
    <Hello />
  </View>
</TouchableWithoutFeedback>

2. Android机型,在长列表下,部分远程图片不显示(确认请求成功、图片没问题,Image组件已经设置固定宽高,加载的图片尺寸远大于容器大小)

原因分析: 由于图像远大于视图,所以在加载该类图片时,容易在低端机型上导致内存不足。解决办法是设置 resizeMethod=resize(默认为auto)。详情,请参考:https://facebook.github.io/react-native/docs/image.html#resizemethod

@wenlei0617
Copy link

wenlei0617 commented Jan 28, 2019

Image组件如果不设置resizeMethod属性,在长列表下有些图片会不显示(加载的图片尺寸都很大,显示的容器相对小)只针对android平台

@hstarorg hstarorg pinned this issue Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants