英文:
In React 18 SSRProvider is not necessary and is a noop. You can remove it from your app, how to resolve this warning?
问题
Hello,我在React Native中遇到了这个错误。
在React 18中,SSRProvider是不必要的,它是一个空操作。您可以从应用程序中将其删除。
我尝试了使用@react-aria/ssr并使用<SSRProvider store={store}>而不是<Provider store={store}>,但没有解决这个警告。任何建议都将很有帮助。
我正在使用React 18.2.0,native base ^3.4.28,React Native 0.71.8。
以下是我的App.js中的代码:
<Provider store={store}>
<NativeBaseProvider theme={theme}>
<SafeAreaView style={{ flex: 1, backgroundColor: '#292929' }}>
<StatusBar
translucent
backgroundColor="#292929"
barStyle="light-content"
/>
<AppNavigation />
</SafeAreaView>
</NativeBaseProvider>
</Provider>
我尝试了使用@react-aria/ssr并使用<SSRProvider store={store}>而不是<Provider store={store}>,但没有解决这个警告。任何建议都将很有帮助。
英文:
Hello people im getting this error in react native
In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app
I have tried this @react-aria/ssr and used <SSRProvider store={store}> instead of <Provider store={store}>, but not resolved the warning. any suggestions would be helpful.
Im using react 18.2.0, native base ^3.4.28, react native 0.71.8.
below is my code in App.js
<Provider store={store}>
<NativeBaseProvider theme={theme}>
<SafeAreaView style={{flex: 1, backgroundColor: '#292929'}}>
<StatusBar
translucent
backgroundColor="#292929"
barStyle="light-content"
/>
<AppNavigation />
</SafeAreaView>
</NativeBaseProvider>
</Provider>
I have tried this @react-aria/ssr and used <SSRProvider store={store}> instead of <Provider store={store}>, but not resolved the warning. any suggestions would be helpful.
答案1
得分: 11
- 转到 node_modules/native-base/src/core/NativeBaseProvider.tsx
- 删除包裹 {children} 的 <SSRProvider></SSRProvider>。请注意不要删除 {children}。
- 移除 SSRProvider 导入。也就是删除这行代码 import { SSRProvider } from '@react-native-aria/utils';
- 运行 npx patch-package native-base。在提示中选择是。
当 Native Base 正式修复此问题时,您可以从创建的补丁目录中删除补丁并重新安装 native-base。
> 链接:https://github.com/GeekyAnts/NativeBase/issues/5758
英文:
- Navigate to node_modules/native-base/src/core/NativeBaseProvider.tsx
- Delete <SSRProvider></SSRProvider> that wraps {children}. Take care not to delete {children}.
- Remove SSRProvider import. That is, delete this line import { SSRProvider } from '@react-native-aria/utils';
- Run npx patch-package native-base. Select yes in the prompt.
When Native Base officially fixes it, you can delete the patch from the patch directory that was created and reinstall native-base
答案2
得分: -1
为我添加了这个:
useEffect(() => {
LogBox.ignoreLogs(['在 React 18 中,SSRProvider 不再必要,是一个无操作项。您可以从您的应用程序中删除它。']);
}, []);
不要忘记导入 LogBox
:
import { LogBox } from 'react-native';
英文:
for me I added this:
useEffect(() => {
LogBox.ignoreLogs(['In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.']);
}, []);
Don't forget to import {LogBox} from 'react-native';
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论