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

[Feature]Portal 内的组件无法获取到 Portal 外部的 Context #1831

Closed
yinhangfeng opened this issue Apr 9, 2020 · 0 comments · Fixed by #1866
Closed

[Feature]Portal 内的组件无法获取到 Portal 外部的 Context #1831

yinhangfeng opened this issue Apr 9, 2020 · 0 comments · Fixed by #1866
Labels

Comments

@yinhangfeng
Copy link

Describe the bug

Portal 内的组件无法获取到 Portal 外部的 Context

To Reproduce

const TestContext = createContext(0);

function TestPortal() {
  const value = useContext(TestContext);
  return <View>{value}</View>;
}

function Test() {
  const [value, setValue] = useState(1);
  return (
    <TestContext.Provider value={value}>
      <View>
        {createPortal(<TestPortal/>, document.body)}
      </View>
    </TestContext.Provider>
  );
}

(please complete the following information)

  • Device: mac
  • OS: mac
  • Browser chrome
  • Rax Version 1.1.1
  • rax-create-portal 1.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant