microsoft / microsoft/react-native-windows
I shouldn't have to prepend my eventnames with "top"
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
ConstantProviderDelegate SomeViewManager::ExportedCustomDirectEventTypeConstants() noexcept
{
return [](winrt::Microsoft::ReactNative::IJSValueWriter const& constantWriter) {
WriteCustomDirectEventTypeConstant(constantWriter, "Foo");
}
...
ReactContext().DispatchEvent(someView, L"topFoo", args);
Most of our code is built around some constants in the class (e.g. SomeViewManager::Foo) instead of using literals everywhere.
Which means I need to do things like
winrt::to_hstring(std::string("top") + eventName);
It used to work without having to manually add "top", the internal DispatchEvent should handle these types of things or have appropriate functions to call like DispatchTopEvent
Even in the SampleApp
they are using "topLabelChanged" and "LabelChanged"
Also in places like this
https://github.com/react-native-community/react-native-video/blob/91384d848953d8c8b526a10f45d44f1bd38c62f0/windows/ReactNativeVideoCPP/ReactVideoView.cpp#L103
where Load, End, Seek, Progress were the registered names, but then someone had to fire "topLoad", "topEnd", "topSeek", and "topProgress"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ExportedCustomDirectEventTypeConstants and the ReactContext().DispatchEvent call shown in the issue, then compare the registered names with the SampleApp examples and ReactVideoView.cpp. Done means native event dispatch no longer requires callers to manually prepend "top" to registered event names, with the affected event behavior covered by the repository's tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, react-native
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100