如何使用 react-native show/hide 内容?

How to show/hide content using react-native?

如何使用react-native创建下拉菜单?

如何show/hide内容?

https://github.com/alinz/react-native-dropdown

这将为您提供类似于您所要求的下拉菜单。 Showing/Hiding 的内容只是决定是否呈现可以通过多种方式完成的内容。

render() {
    let hideableContent;

    if (this.state.shouldRenderContent) {
        hideableContent = <Text>I AM SHOWING</Text>;
    }

    return (
        <View>
            <Text>This doesn't hide</Text>
            {hideableContent}
        </View>
    );
}