如何更改键盘上的“返回”按钮?

时间:2018-06-24 09:39:10

标签: react-native

如何将ios的返回按钮更改为其他本机按钮?

现在它显示灰色的return按钮,而我希望它显示为蓝色,并带有其他文本,例如以下示例:

示例:

enter image description here

2 个答案:

答案 0 :(得分:11)

您应该使用 returnKeyType 属性来确定返回键的外观

示例:

 <TextInput style={{height:40}} 
       placeholder="Input"
       placeholderTextColor="#DCDCDC"
       returnKeyType="Go"
 /> 

答案 1 :(得分:0)

更新2019:使用版本import Foundation enum ArithmeticExpression { case number(Int) indirect case addition(ArithmeticExpression, ArithmeticExpression) indirect case multiplication(ArithmeticExpression, ArithmeticExpression) } var a = readLine()!.split(separator: " ").map{Int(String($0))!} var nums = [a] let x = ArithmeticExpression.number(nums[1]) let y = ArithmeticExpression.number(nums[1]) let sum = ArithmeticExpression.addition(x, y) let product = ArithmeticExpression.multiplication(sum, ArithmeticExpression.number(2)) func evaluate(_ expression: ArithmeticExpression) -> Int { switch expression { case let .number(value): return value case let .addition(left, right): return evaluate(left) + evaluate(right) case let .multiplication(left, right): return evaluate(left) * evaluate(right) } } 时,已接受的答案不再有效,因为“ Go”不是可接受的值之一,请改用“ go”而不使用大写字母

实际的react-native 0.57合同规定了以下枚举:

react-native 0.57