将 <TextInput /> 标签放在 <ScrollView /> 下
Placing the <TextInput /> Tag Under a <ScrollView />
几天前,在开发聊天应用程序时,我遇到了一个我无法解决的问题。我不得不在滚动视图下保留一个文本输入,但它不会出现在那里,这是代码:
<MyStatusbar />
<MyHeader title = 'Jane Doe' color = '#6a11cb'/>
<ImageBackground style = { styles.IMG } source = { images.gradient_1 }>
<ScrollView>
<Text style = { styles.disclaimer }>Content is Encrypet as per a private database. Oval Inc Corp will not be held responsile for any leaks within Images.</Text>
{
this.state.MessageArray.map((message) => {
return(
<View key = { message }>
<TouchableOpacity
onPress = {() => {
}}
>
<Text style = { isNaN(message) ? styles.goingMessages : styles.incomingMessages } >{ isNaN(message) ? message : this.state.MessageArray2[message] }</Text>
</TouchableOpacity>
</View>
);
})
}
</ScrollView>
<View>
<TextInput style = { styles.orInput1 } placeholder = 'Type Here...' />
</View>
</ImageBackground>
提前致谢!
这可能有帮助
<ImageBackground
style={{flex: 1, width: "100%", height: "100%",}}
source={images.gradient_1}>
<View style={{ flex: 1 }}>
<ScrollView>... ...</ScrollView>
</View>
<View>
<TextInput style={styles.orInput1} placeholder="Type Here..." />
</View>
</ImageBackground>;
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
width: "100%",
height: "100%",
},
});
我看到你写的是 Text 而不是 TextInput 是错误吗?如果是这样,那只是语法错误导致您的应用程序崩溃
几天前,在开发聊天应用程序时,我遇到了一个我无法解决的问题。我不得不在滚动视图下保留一个文本输入,但它不会出现在那里,这是代码:
<MyStatusbar />
<MyHeader title = 'Jane Doe' color = '#6a11cb'/>
<ImageBackground style = { styles.IMG } source = { images.gradient_1 }>
<ScrollView>
<Text style = { styles.disclaimer }>Content is Encrypet as per a private database. Oval Inc Corp will not be held responsile for any leaks within Images.</Text>
{
this.state.MessageArray.map((message) => {
return(
<View key = { message }>
<TouchableOpacity
onPress = {() => {
}}
>
<Text style = { isNaN(message) ? styles.goingMessages : styles.incomingMessages } >{ isNaN(message) ? message : this.state.MessageArray2[message] }</Text>
</TouchableOpacity>
</View>
);
})
}
</ScrollView>
<View>
<TextInput style = { styles.orInput1 } placeholder = 'Type Here...' />
</View>
</ImageBackground>
提前致谢!
这可能有帮助
<ImageBackground
style={{flex: 1, width: "100%", height: "100%",}}
source={images.gradient_1}>
<View style={{ flex: 1 }}>
<ScrollView>... ...</ScrollView>
</View>
<View>
<TextInput style={styles.orInput1} placeholder="Type Here..." />
</View>
</ImageBackground>;
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
width: "100%",
height: "100%",
},
});
我看到你写的是 Text 而不是 TextInput 是错误吗?如果是这样,那只是语法错误导致您的应用程序崩溃