MetaMask / MetaMask/metamask-mobile

Signature Request components - refactor getStyle method

Open
#5,568 1 comment 0 reactions 0 assignees View on GitHub
area-signatures team-confirmations-planning type-pinned type-tech-debt
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### **Description**

`getStyle` method is duplicated in all 3 signature request components - [MessageSign](https://github.com/MetaMask/metamask-mobile/blob/18dc20b8cc9f3f0707f5eb04f2ac88ee320c93bb/app/components/UI/MessageSign/index.js), [PersonalSign](https://github.com/MetaMask/metamask-mobile/blob/44fd8450a84ebde8510a244ee1eda4b2e12a1df1/app/components/PersonalSign/index.js), [TypedSign](https://github.com/MetaMask/metamask-mobile/blob/18dc20b8cc9f3f0707f5eb04f2ac88ee320c93bb/app/components/UI/TypedSign/index.js)

This function can be extracted out into [ThemeContext](https://github.com/MetaMask/metamask-mobile/blob/bdb7f37c90e4fc923881a07fca38d4e77c73a579/app/util/theme/index.ts).

The function is in-fact duplicated at couple of other places also in code base. Those can also be refactored.

### **Acceptance Criteria**
- Styling of none of the pages refactored is effected.

### **References**
https://docs.google.com/document/d/19xKY4e07UThOa1jsDQA8pjsNLUBRn39EdUbaFpz3OR0/edit?usp=sharing

Contributor guide

Open the contributing guide

Research direction

Start with getStyle in app/components/UI/MessageSign/index.js, app/components/PersonalSign/index.js, and app/components/UI/TypedSign/index.js, then read app/util/theme/index.ts. Compare the duplicated implementations and check the other duplicated locations mentioned in the issue. Done means the shared implementation is used without affecting styling on any refactored page.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.