Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support coustom popup body #17

Merged
merged 7 commits into from
Jun 30, 2019
Merged

support coustom popup body #17

merged 7 commits into from
Jun 30, 2019

Conversation

taixw2
Copy link
Contributor

@taixw2 taixw2 commented May 22, 2019

No description provided.

@carsonwah
Copy link
Owner

carsonwah commented Jun 15, 2019

I think for custom body, we could use renderPopupContent() instead of renderPopupContent({ appIconSource, appTitle, timeText, title, body }). What do you think?

@carsonwah
Copy link
Owner

I think your approach is good. Just ignore my previous comment.

@taixw2
Copy link
Contributor Author

taixw2 commented Jun 23, 2019

Yes, The parameters are passed through the show method, so if you don't pass the parameters back to renderPopupContent , you may need to write some additional methods to get the parameters.

@taixw2
Copy link
Contributor Author

taixw2 commented Jun 23, 2019

I wonder if the shadow style can be separated from the animation style, because I need to modify the shadow 😅

@carsonwah
Copy link
Owner

@taixw2 You may try removing the shadow and radius from <Animated.View>, and put it into:

<Animated.View
        style={getAnimatedContainerStyle({containerSlideOffsetY, containerDragOffsetY, containerScale})}
        {...this._panResponder.panHandlers}>
        <TouchableWithoutFeedback onPress={onPressAndSlideOut}>
          <View>  // <-- put style HERE

I haven't try this yet, but in this way, everyone can customize the shadow using their own custom body.

@carsonwah
Copy link
Owner

carsonwah commented Jun 27, 2019

Since I have merged #20. Could you also update the typescript typings for the new prop?

Thanks so much for the contribution and sorry for the late replies.

@taixw2
Copy link
Contributor Author

taixw2 commented Jun 28, 2019

@carsonwah I have added the corresponding type definition and added style prop.

@carsonwah
Copy link
Owner

I think we can let user customize the whole popup body. So, style prop may not be very useful.

I would propose something like:

<Animated.View
        style={getAnimatedContainerStyle({containerSlideOffsetY, containerDragOffsetY, containerScale})}
        {...this._panResponder.panHandlers}>
        <TouchableWithoutFeedback onPress={onPressAndSlideOut}>
          <View>  // No style here
            {this.renderPopupContent()}
          </View>
        </TouchableWithoutFeedback>
      </Animated.View>
renderPopupContent() {
    const { appIconSource, appTitle, timeText, title, body } = this.state;
    const { renderPopupContent } = this.props;
    if (renderPopupContent) {
      return renderPopupContent({ appIconSource, appTitle, timeText, title, body });
    }

    return (
      <View style={styles.popupContentContainer}>  // <-- Moved here, i.e. show shadow only for default popup

I cannot commit to your branch, so if you would like to, I can merge this PR first and add amendments.

@taixw2
Copy link
Contributor Author

taixw2 commented Jun 29, 2019

Agree, your approach is better.

@carsonwah carsonwah merged commit 4b339dd into carsonwah:master Jun 30, 2019
@carsonwah
Copy link
Owner

Merged. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants