set button in position “fixed” in React Native

后端 未结 4 1640
再見小時候
再見小時候 2021-02-13 06:38

I would like set button on the bottom right corner width fixed position in React Native.

position: fixed don\'t work in React Native and stickyHeaderI

相关标签:
4条回答
  • 2021-02-13 07:16

    Try this:

    render() {
        return (
          <View style={{flex:1}}>
            <View style={{borderWidth:1,position:'absolute',bottom:0,alignSelf:'flex-end'}}>
               <Button
                 title="Press"
                 color="#841584"
                 accessibilityLabel="Press"/>
            </View>
          </View>
        );
      }
    

    Output:

    0 讨论(0)
  • 2021-02-13 07:29
    <View style={{flex: 1}}>
        <ScrollView style={{backgroundColor:'yellow'}}>
              <Text>body</Text>
        </ScrollView>
        <View><Text>sticky footer</Text></View>
    </View>
    
    0 讨论(0)
  • 2021-02-13 07:35

    If you are using Native Base you can just use the Footer Component

    0 讨论(0)
  • 2021-02-13 07:37

    Just put the component outside of the scrollview and set it with position absolute

    0 讨论(0)
提交回复
热议问题