小编Jon*_*as 的帖子

如何在 React Native 中删除警告

我正在开发一个应用程序,我正在使用,bottomTabNavigator但同时我收到了这个警告!( Look like you're passing an inline function for 'Component' prop for the screen 'Feed' (e.g component={()=><SomeComponent/>)). Passing an inline function will cause the component state to be lost on re-render and cause perf issue since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.

我知道我做错了什么,但我不知道我的代码有什么问题。我是 React Native 的新手,有人可以帮我解决这个警告吗?

代码

 return (
      <NavigationContainer>
        <Tab.Navigator
          initialRouteName="Home"
          tabBarOptions={{
            activeTintColor: "#e91e63"
          }}
        >
          <Tab.Screen
            name="Home"
            component={props => (
              <PharmacyHome
                catId={this.props.navigation.state.params} …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 reactjs react-native

15
推荐指数
3
解决办法
5147
查看次数

如何在expo中选择多张图片

我正在开发 React Native 应用程序,并且正在使用 expo lib。我想要从图库中选择多个图像的功能,但我失败了,因为我是 React Native 的新手。有人可以帮我如何在博览会中选择多个图像吗?

代码

    let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        quality: 1,
        allowsMultipleSelection: true,
        base64: false,
    });
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 reactjs react-native react-redux

4
推荐指数
1
解决办法
1万
查看次数

如何在 React 中实现基于多角色的授权

我正在开发具有不同多角色(管理员、用户、经理)的应用程序,我想保护管理员的路径不受经理的影响,一般用户也根据用户角色呈现 UI。我试过但我失败了有人可以帮助我如何实现我的目标。 示例将不胜感激

谢谢

javascript ecmascript-6 reactjs react-router react-redux

3
推荐指数
1
解决办法
1万
查看次数