Skip to content

feat: Replace EventEmitter with EventTarget in Dimensions#57432

Open
retyui wants to merge 1 commit into
react:mainfrom
retyui:chore/retyui/Dimensions.addEventListener
Open

feat: Replace EventEmitter with EventTarget in Dimensions#57432
retyui wants to merge 1 commit into
react:mainfrom
retyui:chore/retyui/Dimensions.addEventListener

Conversation

@retyui

@retyui retyui commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary:

Motivation: Make addEventListener(...) method - event target like

So, Dimensions.addEventListener now accept 3rd argument with options { once?: boolean, signal?: AbortSignal }

// 1. `once: true` - the listener would be automatically removed when invoked
Dimensions.addEventListener('change', listener, {once: true});

// 2. `signal?: AbortSignal` the listener will be removed when the `abort()` method
const controller = new AbortController();
Dimensions.addEventListener('change', listener, {signal: controller.signal});

Changelog:

[GENERAL] [CHANGED] - Replace EventEmitter with EventTarget in Dimensions

Test Plan:

yarn fantom packages/react-native/Libraries/Utilities/__tests__/Dimensions-itest.js --watch

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 3, 2026
@facebook-github-tools facebook-github-tools Bot added p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 3, 2026
@retyui

retyui commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

can't build types (

yarn build-types    


Analysis will use the bundled TypeScript version 5.8.2
/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:338
                                    throw new node_core_library_1.InternalError(`Unable to follow symbol for "${identifierNode.text}"`);
                                          ^

InternalError: Internal Error: Unable to follow symbol for "AbortSignal"

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
    at AstSymbolTable._analyzeChildTree (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:338:43)
    at AstSymbolTable._analyzeChildTree (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:387:18)
    ... collapsed 7 duplicate lines matching above 1 lines 7 times...
    at AstSymbolTable._analyzeAstSymbol (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:257:18)
    at /Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:269:34
    at AstDeclaration.forEachDeclarationRecursive (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstDeclaration.js:178:9)
    at AstDeclaration.forEachDeclarationRecursive (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstDeclaration.js:180:19)
    at AstSymbol.forEachDeclarationRecursive (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbol.js:103:28)
    at AstSymbolTable._analyzeAstSymbol (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:264:27)
    at AstSymbolTable.analyze (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:123:25)
    at /Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:263:62
    at Map.forEach (<anonymous>)
    at ExportAnalyzer._collectAllExportsRecursive (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:252:48)
    at ExportAnalyzer.fetchAstModuleExportInfo (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/ExportAnalyzer.js:194:18)
    at AstSymbolTable.fetchAstModuleExportInfo (/Users/RN/node_modules/@microsoft/api-extractor/lib/analyzer/AstSymbolTable.js:99:37)
    at Collector.analyze (/Users/RN/node_modules/@microsoft/api-extractor/lib/collector/Collector.js:224:111)
    at Extractor.invoke (/Users/RN/node_modules/@microsoft/api-extractor/lib/api/Extractor.js:154:19)
    at buildAPISnapshot (/Users/RN/scripts/js-api/build-types/buildApiSnapshot.js:71:37)
    at async main (/Users/RN/scripts/js-api/build-types/index.js:87:5) {
  unformattedMessage: 'Unable to follow symbol for "AbortSignal"'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant