我今天(2020 年 4 月 3 日)创建了一个新的 react-native 项目并添加了一个 native-base。然后我尝试使用浮动标签添加输入。它给出了一条警告消息:动画:useNativeDriver未指定。这是一个必需选项,必须显式设置为true或false。如果我删除了浮动标签属性或将其更改为 stackLabel 警告消失了。出现此警告时,onChangeText未调用。
组件文件
import React from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import {Input, Item, Label} from 'native-base';
import {Colors} from 'react-native/Libraries/NewAppScreen';
declare var global: {HermesInternal: null | {}};
const App = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<View style={styles.body}>
<Item floatingLabel>
<Label>Test</Label>
<Input onChangeText={text => console.log(text)} />
</Item>
</View>
</ScrollView> …Run Code Online (Sandbox Code Playgroud) 我正在使用原生基础在反应原生中制作应用程序.我对这两件事都不熟悉.当我运行应用程序它给了我这个错误:
这是我的代码:
export default class Point extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='menu' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right />
</Header>
</Container>
);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的版本的截图
和nativebase版本是 "native-base": "^2.1.2"
我收到错误:You started loading 'Roboto_medium', but used it before it finished loading使用原生基础时.
我按照官方页面中的说明进行操作.
创建反应原生应用我正在使用create-react-native-app.
App.js
export default class App extends React.Component {
async componentWillMount() {
await Expo.Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
'Ionicons': require('@expo/vector-icons/fonts/Ionicons.ttf'),
});
}
render() {
return (
<Container>
<StatusBar hidden={true} />
<Button>
<Text>
Button
</Text>
</Button>
<ListaItens />
</Container>
);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用React Native和Native Base库.当键盘打开时,我需要一个onPress事件来触发Native Base的ListItem(相当于TouchableOpacity).
我现在必须单击一次关闭键盘,然后我可以按ListItem.
下面的内容标记等同于ScrollableView:
<Content keyboardShouldPersistTaps='always' keyboardDismissMode='on-drag'>
<List>
<ListItem style={styles.inspectionsItemDivider} itemDivider>
<TextInput
autoFocus={true}
ref={(input) => { this.titleSearch = input }}
placeholder='Start typing...'
multiline={true}
onChangeText={this.setSearchText.bind(this)}
value={this.getSearchValue()}/>
</ListItem>
<View style={styles.searchContainer}>
<Text style={styles.recentText}>Recommended Descriptions</Text>
<List dataArray={this.state.searchedDescriptions}
renderRow={(description) =>
<ListItem button onPress={() => this.setInformationDescription(description)}>
<Text>{description}</Text>
</ListItem>
</List>
</View>
</List>
</Content>
Run Code Online (Sandbox Code Playgroud) 嗨,我想知道有一种方法可以在React Native中垂直对齐.我试图在底部定位,但我认为我无法找到一个好方法.
如果有人知道如何解决这个问题,请告诉我.
谢谢,
我发现React Native有两个UI组件,它们主要使用.我想用其中一个.哪一个更容易使用和可定制?
大家好,我在 React Native 中遇到此错误在 React 18 中,SSRProvider 不是必需的,并且是一个 noop。您可以从您的应用程序中删除它我已经尝试过这个@react-aria/ssr并使用而不是,但没有解决警告。任何的意见都将会有帮助。
我使用反应18.2.0,本机基础^ 3.4.28,反应本机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>
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个 @react-aria/ssr 并使用代替,但没有解决警告。任何的意见都将会有帮助。
通过使用这个代码(在下面),应用程序已经RTL但右和左的位置发生了变化(所以必须在右边显示的东西都转向左).我是通过教程完成的.
ReactNative.I18nManager.allowRTL(true);
Run Code Online (Sandbox Code Playgroud)
另一个问题是当Mobile的语言是LTR时,图像和设计的位置变成了另一面(例如从右到左的变化),因为App只有一种LTR语言.有没有办法让人们像对方一样展示RTL和LTR?
我使用nativebase.io作为我的应用程序的UI框架.
当我输入IOS设备的标题时,如果iPhone模拟器正在模拟iPhone X(屏幕顶部有一个凹口),Header元素会自动检测到这一点,并将Header元素移到屏幕下方.
一些Android设备在屏幕顶部也有类似的缺口,但是当我使用nativebase.io Header元素时,它不会检测到缺口并且Header与缺口重叠.
是否有一种方法在react-native或nativebase.io上检测显示是否有缺口?这样我就能动态地偏移Header.