mohebifar / mohebifar/react-native-copilot

The problem with using copilot and connect in one file.

Open
#152 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Current Behavior
Since copilot requires the use of export default, and I already made export default for connect, a problem arose. All the options that I found to solve the problem allow you to either run or copilot or connect.
Here is my code now:

Input Code

import PropTypes from 'prop-types'
class App extends Component {
    static propTypes = {
        start: PropTypes.func.isRequired,
        copilotEvents: PropTypes.shape({
            on: PropTypes.func.isRequired,
        }).isRequired,
    }

    constructor(props) {
        super(props)
        this.waterfallTips = new Tips.Waterfall(
            ['contacts', 'events', 'actionButton'],
            {
                onEnd: async () => {
                    await AsyncStorage.setItem('@Tips', true)
                },
            }
        )

        this.state = {
           // another params of state
            secondStepActive: true,
        }
        this.handleNextTips = this.handleNextTips.bind(this)
        OneSignal.inFocusDisplaying(0)
    }

   
    render() {
        //.....
}


const mapStateToProps = ({
    UserReducer,
    NotificationsReducer,
    GroupsReducer,
    ContactsReducer,
    CalendarReducer,
    ModalsReducer,
}) => {
    return {
        UserReducer,
        contactsData: ContactsReducer.contactsDataToShow,
        NotificationsReducer,
        groupsData: GroupsReducer.groups,
        CalendarReducer,
        ModalsReducer,
    }
}

export default connect(
    mapStateToProps,
    actions
)(copilot()(App))

Expected behavior/code
tell me how to make them work together
Now I get this error:
Снимок экрана 2019-09-09 в 19 19 26

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file or test; start with the App component and the shown export statement combining connect and copilot. Reproduce the reported error, then verify that both wrappers work together in the same file without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.