useTheme hook should return the correct type that contains user-defined properties.
The type returned by useTheme hook is not customizable in any way right now. It always returns a type containing only properties defined by the library. It would be handy if user-defined properties are also properly typed.
@satya164 Would you like to explain how this could be implemented? Or at least post some link where we could see how it is done in other libs?
If it was an interface instead of Type we could use module augmentation to do so.
@Trancever I think we can do following:
declare global {
namespace ReactNativePaper {
interface Theme {
// Our theme properties here
}
}
}
Then users will be able to do the same to add any new properties.
Hello 馃憢, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.
This is fixed in 4.0.0
Most helpful comment
@Trancever I think we can do following:
Then users will be able to do the same to add any new properties.