填坑
ListView前面有space
<ListView
automaticallyAdjustContentInsets={false}/>
如果还是不行,则在ListView
前加入一个空的View
<View/>
<ListView
automaticallyAdjustContentInsets={false}/>
ListView 内容不见了
当前react native 页面有一个ListView,点击某个item跳转到 ios 的native 页面,再点击某个按钮返回到 react native的页面,结果页面上ListView里面的东西 消失了!(但其它东西还在)
后来把 ListView的 removeClippedSubviews
设置为false就好了。
iOS 8上 Number undefined
Number.parseFloat('123.456').toFixed(1)
以上代码在iOS 8
上报错,修改成如下即可
parseFloat('123.456').toFixed(1)
react navigation 导航时阴影
const AppNavigator = StackNavigator(this.routeConfig,
{
headerMode: 'none',
cardStyle: {
// 解决导航时阴影问题
// https://github.com/react-community/react-navigation/issues/619
opacity: 1,
}
}
);
Expect all root views to have unique tag. Added 1 twice
React Native
整合现有 iOS
工程时报错:
Expect all root views to have unique tag. Added 1 twice
https://github.com/wix/react-native-controllers/issues/85
- (NSNumber *)reactTag
{
RCTAssertMainQueue();
// if (!super.reactTag)
{
self.reactTag = [_bridge.uiManager allocateRootTag];
}
return super.reactTag;
}
修改Image图标颜色
<Image style={{tintColor: 'orange'}} source={require('')}/>
setState方法是异步的
this.state = {isLoading: false};
// case 1
this.setState({isLoading: true});
console.log(this.state.isLoading); // false
// case 2
this.setState({isLoading: true}, ()=>{
console.log(this.state.isLoading); // true
});