Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Inherit Style #22

Closed
luco wants to merge 1 commit into baijunjie:master from luco:patch-4
Closed

Inherit Style #22

luco wants to merge 1 commit into baijunjie:master from luco:patch-4

Conversation

@luco
Copy link
Contributor

@luco luco commented Feb 20, 2018

Without this, we can't use flex and other inherited styles.

Without this, we can't use flex and other inherited styles.
Copy link
Owner

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?

Copy link
Contributor Author

luco commented Feb 22, 2018

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?

Copy link
Owner

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.

luco reacted with thumbs up emoji

Copy link
Contributor Author

luco commented Apr 3, 2018

@baijunjie It works! thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /