使用 React Navigation 5 时 Native Base Content 为空
Native Base Content is empty when using React Navigation 5
我正在尝试使用 React Navigation 5 和 Native Base 创建一个基本应用程序。但似乎 React Navigation 覆盖了 Native Base。内容不呈现简单文本。
/**
* @format
*/
import React from 'react';
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import NavigationInitializer from './route/NavigationSetup';
import { name as appName } from './app.json';
import { LogBox } from 'react-native';
import { Root, Container, Content, Header, Text, Footer } from 'native-base';
LogBox.ignoreAllLogs(); // remove unnecessary warnings
// This is useful when there's a noisy warning that cannot be fixed, like those in a third-party dependency.
// AppRegistry.registerComponent(appName, () => NavigationInitializer);
AppRegistry.registerComponent(appName, () => () =>
<Container>
<Header>
<Text style={{ color: "black" }}>
HEADER
</Text>
</Header>
<Content style={{ backgroundColor: "red" }}>
<Text style={{ color: "black" }}>
This is Content Section
</Text>
</Content>
<Footer>
<Text style={{ color: "black" }}>
This is Footer Section
</Text>
</Footer>
</Container>
);
好的。我通过升级 React native 和 native base 解决了这个问题。
https://github.com/GeekyAnts/NativeBase/issues/3204#issuecomment-667596807
我正在尝试使用 React Navigation 5 和 Native Base 创建一个基本应用程序。但似乎 React Navigation 覆盖了 Native Base。内容不呈现简单文本。
/**
* @format
*/
import React from 'react';
import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import NavigationInitializer from './route/NavigationSetup';
import { name as appName } from './app.json';
import { LogBox } from 'react-native';
import { Root, Container, Content, Header, Text, Footer } from 'native-base';
LogBox.ignoreAllLogs(); // remove unnecessary warnings
// This is useful when there's a noisy warning that cannot be fixed, like those in a third-party dependency.
// AppRegistry.registerComponent(appName, () => NavigationInitializer);
AppRegistry.registerComponent(appName, () => () =>
<Container>
<Header>
<Text style={{ color: "black" }}>
HEADER
</Text>
</Header>
<Content style={{ backgroundColor: "red" }}>
<Text style={{ color: "black" }}>
This is Content Section
</Text>
</Content>
<Footer>
<Text style={{ color: "black" }}>
This is Footer Section
</Text>
</Footer>
</Container>
);
好的。我通过升级 React native 和 native base 解决了这个问题。
https://github.com/GeekyAnts/NativeBase/issues/3204#issuecomment-667596807