亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

反應本機:當我單擊另一個頁面的按鈕時,如何更改視圖?

反應本機:當我單擊另一個頁面的按鈕時,如何更改視圖?

互換的青春 2023-09-07 16:40:13
當我從另一個頁面按下按鈕時以及再次按下該按鈕時,我想更改SafeAreaView樣式,以便它返回SafeAreaView. 我希望得到一些幫助。這是Reshima頁面function Reshima({ paramsList = { list: [] } }) {return (      <SafeAreaView style={styles.flat}>        <FlatList          data={filteredList}          renderItem={({ item, index }) => renderItem({ index, item })}          keyExtractor={(item) => item.Water_Source_Code.toString()}          ListEmptyComponent={EmptyListMessage}        />      </SafeAreaView>)}這是AppNavigator按鈕的頁面:const HomeStack = () => {<TouchableOpacity onPress={() => {                  dispatch(setFilterViewVisible(true));                }}>                  <Icon                    color="white"                    style={styles.homeIcon}                    name={                      Platform.OS === 'android'                        ? 'md-search-outline'                        : 'md-search-outline'                    }                    size={30}                  />                </TouchableOpacity>}
查看完整描述

1 回答

?
炎炎設計

TA貢獻1808條經驗 獲得超4個贊

onPress 函數將給出一個 prop,它給出相應的 ToggleButton Pressed 的索引,如果按下第一個按鈕,它給出 0,否則它給出 1 通過這個你可以切換視圖,

const select_radio_props = [

? { label: 'first', value: 0 },

? { label: 'second', value: 1 },

];


export default () => {

? const [value1, onChangeText1] = React.useState('');

? const [value2, onChangeText2] = React.useState('');

? const [value3, onChangeText3] = React.useState('');

? const [initialRadioForm, setInitialRadioForm] = useState(0);

? const [visible, setVisible] = useState(false);


? return (

? ? <>

? ? ? <ScrollView

? ? ? ? behavior={Platform.OS == 'ios' ? 'padding' : 'height'}

? ? ? ? style={styles.container}>

? ? ? ? <View style={styles.MainScreen}>

? ? ? ? ? <View style={styles.WhereToCheckTextView}>

? ? ? ? ? ? <Text style={styles.WhereToCheckText}>where</Text>

? ? ? ? ? </View>

? ? ? ? ? <View style={styles.RadioFormView}>

? ? ? ? ? ? <RadioForm

? ? ? ? ? ? ? formHorizontal={true}

? ? ? ? ? ? ? selectedButtonColor="black"

? ? ? ? ? ? ? buttonColor={'black'}

? ? ? ? ? ? ? animation={true}

? ? ? ? ? ? ? labelHorizontal={true}

? ? ? ? ? ? ? labelStyle={{

? ? ? ? ? ? ? ? fontSize: 18,

? ? ? ? ? ? ? ? left: 5,

? ? ? ? ? ? ? ? color: 'black',

? ? ? ? ? ? ? }}

? ? ? ? ? ? ? buttonSize={20}

? ? ? ? ? ? ? radio_props={select_radio_props}

? ? ? ? ? ? ? initial={initialRadioForm}

? ? ? ? ? ? ? onPress={(val) => {

? ? ? ? ? ? ? ? setVisible(val === 1);

? ? ? ? ? ? ? }}

? ? ? ? ? ? />

? ? ? ? ? </View>

? ? ? ? ? {visible && (

? ? ? ? ? ? <View style={{ width: 200, height: 100, backgroundColor: 'red' }} />

? ? ? ? ? )}

? ? ? ? </View>

? ? ? </ScrollView>

? ? </>

? );

};


查看完整回答
反對 回復 2023-09-07
  • 1 回答
  • 0 關注
  • 112 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號