How to implement radio button in React Native

前端 未结 8 2287
不思量自难忘°
不思量自难忘° 2020-12-25 11:18

I am converting React code to React Native. So I need to implement radio buttons.

8条回答
  •  囚心锁ツ
    2020-12-25 12:20

    You can mimic a radio button really easily using just barebones RN. Here's one simple implementation which I use. Tweak size, colors etc. as you like. It looks like this (with a different tint, and some text). Add TouchableOpacity on top to turn it into a button that does something.

    function RadioButton(props) {
      return (
          
            {
              props.selected ?
                
                : null
            }
          
      );
    }
    

提交回复
热议问题