- 
  Notifications
 You must be signed in to change notification settings 
- Fork 76
Inherit Style #22
Inherit Style #22
Conversation
Without this, we can't use flex and other inherited styles.
This will cause KeyboardAvoidingView and ScrollView to inherit the same style.
Is there any style that must be inherited by KeyboardAvoidingView?
If you use Animate.ScrollView, then the style must be inherited by it.
Or you have a better way to help me improve it so that both are compatible?
In this case, I needed to use flex:1. Let me be more clear. On my project, I needed a button to stick to the bottom of the view and the InputScrollView to fill the remaining space.
The way you set the height, with height:100% doesn't allow to do this. Setting a style inheritance makes this possible. I don't know, maybe use a specific prop to inherit style?
Setting height: 100% is to make InputScrollView more like ScrollView's default height setting
If you add a container outside the InputScrollView, can you solve your problem?
<view style={{ flex: 1 }}> <InputScrollView /> </view> <Button style={{ flex: 0 }} />
If the above method does not work, please help me to test the following modification is feasible
<KeyboardAvoidingView behavior={isIOS ? 'padding' : null}> <View style={[styles.wrap, this.props.style]}> // <= Use this view to inherit the style <ScrollComponent ref={this._onRef} onMomentumScrollEnd={this._onMomentumScrollEnd} onFocusCapture={this._onFocus} {...otherProps}> .... </ScrollComponent> </View> </KeyboardAvoidingView>
If none of the above will work, I will consider your suggestion.
@baijunjie It works! thanks!
Without this, we can't use flex and other inherited styles.